#!/bin/sh

FILE=$1
OUT=/home/hideki/Tmp/

echo "chr_s	pos_s	chr_b	pos_b	score	p_val" > $OUT/chr1-chr1.txt
more $FILE | grep ^chr1 | grep -v chr2 | grep -v chr3 | sed 's/:/	/g' >> $OUT/chr1-chr1.txt

echo "chr_s	pos_s	chr_b	pos_b	score	p_val" > $OUT/chr1-chr2.txt
more $FILE | grep ^chr1 | grep chr2 | sed 's/:/	/g'  >> $OUT/chr1-chr2.txt

echo "chr_s	pos_s	chr_b	pos_b	score	p_val" > $OUT/chr1-chr3.txt
more $FILE | grep ^chr1 | grep chr3 | sed 's/:/	/g' >> $OUT/chr1-chr3.txt

echo "chr_s	pos_s	chr_b	pos_b	score	p_val" > $OUT/chr2-chr2.txt
more $FILE | grep ^chr2 | grep -v chr3 | sed 's/:/	/g'  >> $OUT/chr2-chr2.txt

echo "chr_s	pos_s	chr_b	pos_b	score	p_val" > $OUT/chr2-chr3.txt
more $FILE | grep ^chr2 | grep chr3 | sed 's/:/	/g'  >> $OUT/chr2-chr3.txt

echo "chr_s	pos_s	chr_b	pos_b	score	p_val" > $OUT/chr3-chr3.txt
more $FILE | grep ^chr3 | sed 's/:/	/g'  >> $OUT/chr3-chr3.txt

